// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import VueSocketio from 'vue-socket.io'
require('../API/config.js')
// http://192.168.1.57:20001?type=s_t_ts_c_w
Vue.use(VueSocketio, 'http://' + global.accountIp + ':' + global.scoketport + '?type=s_t_ts_c_w')
// 定义拖动指令
Vue.directive('grag', {
  inserted: function (el, binding) {
    let gDiv = el
    gDiv.onmousedown = function (e) {
      let l = e.clientX - gDiv.offsetLeft
      let t = e.clientY - gDiv.offsetTop
      gDiv.onmousemove = function (e) {
        gDiv.style.left = e.clientX - l + 'px'
        gDiv.style.top = e.clientY - t + 'px'
      }
      gDiv.onmouseup = function () {
        gDiv.onmousemove = null
        gDiv.onmouseup = null
      }
    }
    gDiv.onmouseout = function (e) {
      gDiv.onmousemove = null
      gDiv.onmouseup = null
    }
  }
})
import App from './App'
import store from './store/'
import routerMap from './router'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'

import 'bootstrap/dist/css/bootstrap.css'


Vue.use(VueRouter)
Vue.use(VueResource)
Vue.use(ElementUI)

Vue.http.options.emulateJSON = true

// 并且配置路由规则
const router = new VueRouter({
  mode: 'history',
  base: __dirname,
  routes: routerMap
})

// 路由器会创建一个 App 实例，并且挂载到选择符 #app 匹配的元素上。
const app = new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app')
